import Vue from "vue";
import App from "./App.vue";
import VueRouter from "vue-router";

// 引入子组件
import Index from "@/pages/Index.vue";
import News from "@/pages/News.vue";
import Sports from "@/pages/Sports.vue";
import World from "@/pages/second/World.vue";
import Inboard from "@/pages/second/Inboard.vue";
import Aboard from "@/pages/second/Aboard.vue";

Vue.use(VueRouter);
Vue.config.productionTip = false;

const routes = [
  {
    path: "/index",
    name: "Index",
    component: Index,
  },
  {
    path: "/news",
    name: "News",
    component: News,
  },
  {
    path: "/sports",
    name: "Sports",
    component: Sports,
    children: [
      {
        path: "world",
        component: World,
      },
      {
        path: "inboard",
        component: Inboard,
      },
      {
        path: "aboard",
        component: Aboard,
      },
    ],
  },
];

const router = new VueRouter({
  routes,
});

new Vue({
  router,
  render: (h) => h(App),
}).$mount("#app");
